<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link th:href="@{/css/style.css}" rel="stylesheet" type="text/css" />
<script type="text/javascript" th:src="@{/js/jquery.js}"></script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li>采购管理</li>
    <li>商品类型管理</li>
    <li>添加</li>
  </ul>
</div>
<div class="formbody">
  <div class="formtitle"><span>商品类型信息</span></div>
  <form th:action="@{/purchase/productType/ctypeAdd}" method="post" id="typeForm">
  <ul class="forminfo">
    <li>
      <label>品牌名称</label>
      <select id="brandId" class="dfselect" name="brandId">
      	  <option value="0">请选择</option>
          <option th:each="t:${session.cblist}" th:value="${t.brandId}"
                  th:text="${t.brandName}">联想</option>
        </select>
      <i>必选</i>
    </li>
    <li>
      <label>商品类型名称</label>
      <input id="typeName" name="typeName" type="text" class="dfinput" />
      <i>必填，不能超过50个字符</i>
    </li>
    <li>
      <label>状态</label>
      <select id="typeStatus" class="dfselect" name="typeStatus">
        <option value="0">请选择</option>
          <option th:value="1">可用</option>
          <option th:value="2">不可用</option>
        </select>
      <i>必选</i>
    </li>
    <li>
      <label>创建人</label>
      <input name="createId" type="hidden" th:value="${session.currUser.uId}"/>
      <input name="" type="text" th:value="${session.currUser.uname}" readonly="readonly" class="roinput" />
      <i>不能编辑</i>
    </li>
    <li>
      <label>创建时间</label>
      <input name="createTime" type="text" th:value="${#dates.format(session.date1,'yyyy-MM-dd hh:mm:ss')}" readonly="readonly" class="roinput" />
      <i>不能编辑</i>
    </li>
    <li>
      <label>&nbsp;</label>
      <input onclick="addType()" type="button" class="btn" value="确定"/>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input name="" type="submit" class="btn" value="返回" th:onclick="/erp1/purchase/productType/ctypeAll"/>
    </li>
  </ul>
  </form>
</div>
<script>
  $(function () {
    $("#brandId").blur(function () {
      ckId();
    });
    $("#brandName").blur(function () {
      ckName();
    });
    $("#brandStatus").blur(function () {
      ckStatu();
    });
  });
  function ckId() {
    if ($("#brandId").val()==0) {
      return false;
    }else {
      return true;
    }
  }
  function ckName() {
    if ($("#brandName").val()=="") {
      return false;
    }else {
      return true;
    }
  }
  function ckStatu() {
    if ($("#typeStatus").val()==0) {
      return false;
    }else {
      return true;
    }
  }
  function addType() {
    if (ckId()&&ckName()&&ckStatu()){
      $("#typeForm").submit();
    } else {
      confirm("添加商品类型错误！");
    }
  }
</script>
</body>
</html>
